package com.example.lj.uav.utils;

import android.view.View;
import android.view.animation.AlphaAnimation;

public class AnimUtils {


    /**
     * View渐现动画效果
     */
    public static void setShowAnimation(View view, int duration) {
        if (null == view)
            return;
        if (duration < 50)
            duration = 50;

        AlphaAnimation mShowAnimation = new AlphaAnimation(0.0f, 1.0f);
        mShowAnimation.setDuration(duration);
        view.startAnimation(mShowAnimation);
    }

    /**
     * View渐隐动画效果
     */
    public static void setHideAnimation(View view, int duration) {
        if (null == view)
            return;
        if (duration < 50)
            duration = 50;

        AlphaAnimation mHideAnimation = new AlphaAnimation(1.0f, 0.0f);
        mHideAnimation.setDuration(duration);
        view.startAnimation(mHideAnimation);
    }
}
